package cn.yo2.irain.common.util;

import org.apache.struts2.views.jsp.ComponentTagSupport;
import org.apache.struts2.components.Component;
import com.opensymphony.xwork2.util.ValueStack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by IntelliJ IDEA.
 * User: MiJunfeng
 * Date: 2009-11-9
 * Time: 13:44:06
 * To change this template use File | Settings | File Templates.
 */
public class PagesTag extends ComponentTagSupport {

    private String cpage;
    private String total;
    private String url;
    private String styleClass;
    private String theme;

    public void setTheme(String theme) {
        this.theme = theme;
    }

    public void setStyleClass(String styleClass) {
        this.styleClass = styleClass;
    }

    public void setCpage(String cpage) {
        this.cpage = cpage;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public Component getBean(ValueStack arg0, HttpServletRequest arg1, HttpServletResponse arg2) {
        return new Pages(arg0, arg1);
    }

    protected void populateParams() {
        super.populateParams();

        Pages pages = (Pages) component;
        pages.setCpage(cpage);
        pages.setTotal(total);
        pages.setUrl(url);
        pages.setStyleClass(styleClass);
        pages.setTheme(theme);

    }

}
